package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 结算记录
 * </p>
 *
 * @author linan
 * @date 2023-05-26
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionSettlementInvoicingStatusEnum", description = "开票状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;INVOICED:已开票;REJECTED:被驳回-枚举")
public enum ExhibitionSettlementInvoicingStatusEnum implements BaseEnum {

    /**
     * NOT_APPLIED="未申请"
     */
    NOT_APPLIED("未申请"),
    /**
     * REQUESTED="已申请"
     */
    REQUESTED("已申请"),
    /**
     * INVOICED="已开票"
     */
    INVOICED("已开票"),
    /**
     * REJECTED="被驳回"
     */
    REJECTED("被驳回"),
    /**
     * INVOICING="开票中"
     */
    INVOICING("开票中"),
    /**
     * INVOICE_FAIL="开票失败"
     */
    INVOICE_FAIL("开票失败"),
    /**
     * INVOICE_CANCEL="已取消"
     */
    INVOICE_CANCEL("已取消"),
    /**
     * PAY_NOT_APPROVED="审核不通过"
     */
    PAY_NOT_APPROVED("审核不通过"),
    /**
     * PAY_APPROVED="审核通过"
     */
    PAY_APPROVED("审核通过"),
    /**
     * 开票冲红
     */
    INVOICE_RED("开票冲红")
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionSettlementInvoicingStatusEnum match(String val, ExhibitionSettlementInvoicingStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionSettlementInvoicingStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionSettlementInvoicingStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_APPLIED,REQUESTED,INVOICED,REJECTED", example = "NOT_APPLIED")
    public String getCode() {
        return this.name();
    }

}
